{include file="public/header" /}
<link rel="stylesheet" type="text/css" href="/static/admin/css/layui.css">
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <!-- Panel Other -->
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>资金流水记录</h5>
        </div>
        <div class="ibox-content">
            <!--搜索框开始-->           
            <div class="row">
                <div class="col-sm-12">   

                    <form name="admin_list_sea" class="form-search" method="post" action="{:url('index')}">
                        <div class="col-sm-2">
                                <input type="text" id="key" class="form-control" name="key" value="{$val}" placeholder="输入需查询的会员昵称" />
                        </div>
                        <div class="col-sm-2">
                            <input type="text" id="c" class="form-control" name="c" value="{$c}" placeholder="输入需查询的订单号" />
                        </div>

                        <div class="col-sm-2">

                            <select class="form-control m-b chosen-select" name="account_type" id='account_type'>
                                <option value="0">选择类型</option>
                                <option value="1" {if condition="$account_type eq 1"}selected{/if}>下单</option>
                                <option value="2" {if condition="$account_type eq 2"}selected{/if}>提现</option>
                                <option value="3" {if condition="$account_type eq 3"}selected{/if}>退款</option>
                            </select>

                        </div>

                        <div class="col-xs-2">
                            <input type="text" id="add_time" class="form-control" name="add_time" value="{$add_time}" placeholder="下单时间查询" />
                        </div>



                        <span class="input-group-btn">
                                 <button type="submit" class="btn btn-primary"><i class="fa fa-search"></i> 搜索</button>
                         </span>

                    </form>                         
                </div>
            </div>
            <!--搜索框结束-->
            <div class="hr-line-dashed"></div>
            <div class="col-sm-2">

                <div class="form-group">
                    <label>总计：￥{$mm}元</label>
                </div>

            </div>
            <div class="example-wrap">
                <div class="example">
                    <table class="table table-bordered table-hover">
                        <thead>
                            <tr class="long-tr">
                                <th>ID</th>
                                <th>会员昵称</th>
                                <th>金额</th>
                                <th>操作时间</th>
                                <th>类型</th>
                                <th>备注</th>
                            </tr>
                        </thead>
                        <script id="list-template" type="text/html">
                            {{# for(var i=0;i<d.length;i++){  }}

                            <tr class="long-td">
                                <td>{{d[i].id}}</td>
                                <td>{{d[i].nickname}}</td>
                                <td>{{d[i].user_money}}</td>
                                <td>{{d[i].change_time}}</td>
                                <td>
                                    {{# if(d[i].account_type==1){ }}
                                    <a class="red" href="javascript:;" >
                                        <div id="zt{{d[i].id}}"><span class="label label-info">下单</span></div>
                                    </a>
                                    {{# }else if(d[i].account_type==2){ }}
                                    <a class="red" href="javascript:;" >
                                        <div id="zt{{d[i].id}}"><span class="label label-success">提现</span></div>
                                    </a>
                                    {{# }else{ }}
                                    <a class="red" href="javascript:;" >
                                        <div id="zt{{d[i].id}}"><span class="label label-danger">退款</span></div>
                                    </a>
                                    {{# } }}
                                </td>
                                <td>{{d[i].remark}}</td>
                            </tr>
                            {{# } }}
                        </script>
                        <tbody id="list-content"></tbody>
                    </table>
                    <div id="AjaxPage" style=" text-align: right;"></div>
                    <div id="allpage" style=" text-align: right;"></div>
                </div>
            </div>
            <!-- End Example Pagination -->
        </div>
    </div>
</div>
<!-- End Panel Other -->
</div>

<!-- 加载动画 -->
<div class="spiner-example">
    <div class="sk-spinner sk-spinner-three-bounce">
        <div class="sk-bounce1"></div>
        <div class="sk-bounce2"></div>
        <div class="sk-bounce3"></div>
    </div>
</div>

{include file="public/footer" /}
<script type="text/javascript" src="/static/admin/js/layui.js"></script>
<script type="text/javascript">

    //提交
    $(function(){


        layui.use('laydate', function()
        {
            var laydate = layui.laydate;
            //常规用法
            laydate.render({
                elem: '#add_time',
                range: '~'
            });

        });

    });

    //laypage分页
    Ajaxpage();
    function Ajaxpage(curr){
        var key=$('#key').val();
        var c=$('#c').val();
        var s_id=$('#s_id').val();
        var add_time=$('#add_time').val();
        var account_type=$('#account_type').val();
        $.getJSON('{:url("AccountLog/index")}', {page: curr || 1,key:key,c:c,add_time:add_time,s_id:s_id,account_type:account_type}, function(data){
            $(".spiner-example").css('display','none'); //数据加载完关闭动画 
            if(data==''){
                $("#list-content").html('<td colspan="20" style="padding-top:10px;padding-bottom:10px;font-size:16px;text-align:center">暂无数据</td>');
            }else{
                var tpl = document.getElementById('list-template').innerHTML;
                laytpl(tpl).render(data, function(html){
                    document.getElementById('list-content').innerHTML = html;
                });
                laypage({
                    cont: $('#AjaxPage'),//容器。值支持id名、原生dom对象，jquery对象,
                    pages:'{$allpage}',//总页数
                    skip: true,//是否开启跳页
                    skin: '#1AB5B7',//分页组件颜色
                    curr: curr || 1,
                    groups: 3,//连续显示分页数
                    jump: function(obj, first){
                        if(!first){
                            Ajaxpage(obj.curr)
                        }
                        $('#allpage').html('第'+ obj.curr +'页，共'+ obj.pages +'页');
                    }
                });
            }
        });
    }


</script>
</body>
</html>